<!DOCTYPE html>
<html>
 <head>
  <title>节点属性</title> 
  <meta charset="UTF-8" /> 
  <link rel="stylesheet" type="text/css" href="../../easyui/themes/gray/easyui.css" /> 
  <link rel="stylesheet" type="text/css" href="../../easyui/themes/icon.css" /> 
  <link rel="stylesheet" type="text/css" href="../../css/app_openform.css" /> 
  
  <script type="text/javascript" src="../../easyui/jquery.min.js"></script> 
  <script type="text/javascript" src="../../easyui/jquery.easyui.min.js"></script> 
  <script type="text/javascript" src="../../jscode/sharefunction.js"></script> 
  <script type="text/javascript" src="../../jscode/app_openform.js"></script> 
  <script>

      var CONFIG = [];
      $.ajax({
          url: "../config/config.json",
          //同步请求
          async: false,
          type: 'GET',
          success: function (data) {
              CONFIG = data;
          }
      });

      function formonload() {
	  var Nodeid = GetUrlArg("Nodeid");
	  $("#Nodeid").html(Nodeid);
	  $('#event').attr("src","../view/CommonEventView.html?eventType=startEvent&WF_Action=edit&WF_DocUnid=&Processid="+ GetUrlArg("Processid") +"&Nodeid="+ GetUrlArg("Nodeid") +"&NodeType="+ GetUrlArg("ExtNodeType") +"&WF_Appid=S029")

      var processAttrUrl = CONFIG.url.getFlowChartModByNodeType;
      processAttrUrl = processAttrUrl.replace("{processid}", GetUrlArg("Processid")).replace("{nodeid}", GetUrlArg("Nodeid"));


      $.ajax({
          async:false,
          type:"GET",
          url: processAttrUrl,
          dataType:"json",
          success:function(data){
        	  for(var key in data['基本属性']){
   		　　　	$('#'+key).val(data['基本属性'][key]);
      		　}
          }
      });
  }
  function myBrowser() {
	    var userAgent = navigator.userAgent;
	    var isOpera = userAgent.indexOf("Opera") > -1;
	    if (isOpera) {
	        return "Opera"
	    };
	    if (userAgent.indexOf("Firefox") > -1) {
	        return "FF";
	    }
	    if (userAgent.indexOf("Chrome") > -1) {
	        return "Chrome";
	    }
	    if (userAgent.indexOf("Safari") > -1) {
	        return "Safari";
	    }
	    if ( !! window.ActiveXObject || "ActiveXObject" in window) {
	        if (navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE10.0") {
	            return "IE10"
	        }
	        return "IE"
	    };
	}
	function SaveDocument(btnAction) {
		var map = {};
		if(!$("#NodeName").val()){
	    	$("#NodeName").next().show();
	    	$("#tabs").tabs("select",0);
	    	return false;
	    }else {
	    	$("#NodeName").next().hide();
	    }
	    $("input").each(function(){
	        var input = $(this);
	        if(input.attr("id")!==undefined)
	        map[input.attr("id")] = input.val();
	    });
	    var postData = {
	    	"json":JSON.stringify(map)
	    }

        var saveFlowAttrUrl = CONFIG.url.saveFlowChartModByNodeType;
        saveFlowAttrUrl = saveFlowAttrUrl.replace("{processid}", GetUrlArg("Processid")).replace("{nodeid}", GetUrlArg("Nodeid")).replace("{extnodetype}", GetUrlArg("ExtNodeType"));

        mask();
	    $.post(saveFlowAttrUrl,
   			postData, function(data) {
   	        unmask();
   	        if (data.Status == "error") {
   	            $.messager.alert("Info", data.msg, "Error");
   	        } else {
   	            var NodeName = $("#NodeName").val();
   	            var Nodeid = GetUrlArg("Nodeid");
   	            if (Nodeid != "Process") {
   	                if (opener) {
   	                    opener.SetPropertyVal(Nodeid, NodeName);
   	                } else {
   	                    window.dialogArguments.SetPropertyVal(Nodeid, NodeName);
   	                }
   	            }
   	            if (btnAction == "quit") {
   	                window.close();
   	            }
   	        }
   	    });
	}
	$(function() {
	    $("#tabs").tabs({
	        onSelect: loadUrl
	    });
	    loadUrl();
	});
	function loadUrl() {
	    var tab = $('#tabs').tabs('getSelected');
	    if (tab == null) {
	        return false;
	    }
	    var url = tab.attr("url");
	    var id = tab.attr("id");
	    if ($("#iframe_" + id).attr("src") == "about:blank") {
	        $("#iframe_" + id).attr("src", url);
	    }
	}</script>
 </head>
 <body style="margin:0px;overflow:hidden">
  <div class="easyui-layout" id="panel" fit="true" style="width:100%;"> 
   <div data-options="region:'north',split:false" border="false" style="height:31px;overflow:hidden"> 
    <div class="toptoolbar" id="toptoolbar">
      | 
     <a href="#" class="easyui-linkbutton" plain="true" data-options="iconCls:'icon-save'" onclick="SaveDocument('quit')">保存退出</a> | 
     <a href="#" class="easyui-linkbutton" plain="true" data-options="iconCls:'icon-save'" onclick="SaveDocument()">保存</a> | 
     <a href="#" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-remove'" onclick="window.close();">关闭</a> 
    </div> 
   </div> 
   <div region="center" border="false" fit="false"> 
    <div id="tabs" class="easyui-tabs" fit="true" tabposition="left" data-options="showHeader:true,tabHeight:30">
     <div title="基本属性" id="startEventAttr" iconCls=""  style="padding:0px;overflow:hidden">
     	<table class="linkeytable"><tbody>
		    <tr class="firstRow">
		      <td style="word-break: break-all;" valign="middle" rowspan="1" colspan="1" align="right">节点名称</td>
		      <td valign="middle" rowspan="1" colspan="1" align="left"><input id="NodeName" name="NodeName" value="开始" size="40"/><span style="color:red;display:none">该项为必填项</span></td>
		    </tr>
		    <tr>
		      <td style="word-break: break-all;" valign="middle" rowspan="1" colspan="1" align="right">节点id</td>
		      <td valign="middle" rowspan="1" colspan="1" align="left">
			<span id="Nodeid" class="ue_t" type="xfield" name="Nodeid">{xfield}
			</span>
		</td>
	    </tr>
	</tbody>
	</table>
	  </div> 
	  
	  <div title="事件设置" id="rule" iconCls="icon-event"  style="padding:0px;overflow:hidden">
     	<iframe id="event"  src="" frameborder="0" style="width:100%;height:100%"></iframe>
	  </div> 
	  
    </div> 
   </div>
  </div>
 </body>
</html>